﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HuntTheWumpus
{
	class GameControl
	{
		public static Map map;
		private static Player player = new Player();
		private static Cave cave;
		private static HighScore hScore;

		public void CreatePlayer(String name){
			player = new Player(name);
		}

		public void EndGame()
		{
			int score = player.EndingScore();
			HighScoreStruct newScore = new HighScoreStruct();
			newScore.CaveNumber = 1;
			newScore.Name = player.Name;
			newScore.Score = score;

			hScore.AddNewHighScore(newScore);
		}

		public static void MovePlayer(int newLocation)
		{
			map.PlayerLocation = newLocation;
		}

		public GameControl()
		{
			map = new Map();
			map.mainmap();
			cave = new Cave();
			cave.ReadCaveFile(1);
			hScore = new HighScore();
		}

		public static void playerMoved()
		{
			player.Gold++;
			player.TurnNumber++;
		}

		public static void playerUsedArrow()
		{
			player.Arrows--;
		}
		public static void playerBaughtArrow()
		{

		}

		public static int[] GetConnections(int RoomNumber)
		{
			return cave.rooms[RoomNumber].connections;
		}
		public void startGame()
		{

		}
		public static List<String> UIInformation()
		{
			//0 Gold
			//1 Arrows
			//2 TurnNumber
			//3 RoomNumber
			//4 Hints
			List<String> returnArguments = new List<String>();
			returnArguments.Add(player.Gold + "");
			returnArguments.Add(player.Arrows + "");
			returnArguments.Add(player.TurnNumber + "");
			returnArguments.Add((map.PlayerLocation + 1) + "");
			returnArguments.Add(generateHints());
			return returnArguments;
		}
		public static String generateHints()
		{
			return "";
		}
		public static bool shootArrow(int roomNumber)
		{
			player.Arrows--;
			//Check to see if hit
			return false;
		}
		public static List<String> getHints(int roomNumber)
		{
			return null;
		}
		public static String[,] getTrivia(int numQuestions)
		{
			return null;
		}
		public static bool DoTrivia(int numberQuestions)
		{
			newQuestionButton form = new newQuestionButton();
			form.Visible = true;
			return false;
		}
	}
}
